

$(document).ready(function() {
	
	var $gallery = $(".hotels, .schools");
	
	var $hotels = $('.hotels');
	
	var $schools = $('.schools');
	
	var $scht = $('.schools ul li');
	
	//console.log(window.ajaxUrl);
	/*
	$('img',$gallery).live('mouseenter', function() {
		var $this = $(this);
		console.log($this);
		$this.draggable({
			cursor: "move"
		});
	});
	*/
	
	$hotels.draggable({
		helper: 'clone',
		cursor:'move', 
		revert: 'invalid',
		opacity:0.35,
		revertDuration: 300,
		containment: null, 
		start: function(e,ui) {
			
		},
		end: function(e,ui) {
			
		}
	});
	
	$schools.droppable({
		activeClass: "ui-state-hover",
		hoverClass: "ui-state-active",
		//tolerance: "fit",
		activate: function(event, ui) {
			//console.log('activate');
		},
		deactivate: function(event, ui) {
			//console.log('deactivate');
		},
		drop: function(event, ui) {
			//console.log('drop');
			//console.log(ui.draggable);
			console.log($(this));
			
			var hotelName = $.trim(ui.draggable.text());
			var hotelElement = '<ul class="gallery ui-helper-reset"></ul>';
			console.log(hotelName);
			//console.log($(this));
			
			
			/*
			var h_id = $(ui.draggable).attr('rel');
			
			if (!h_id) {
				var h_id = $(ui.draggable).attr('id');
				console.log(h_id);
			}
			*/
		}, 
		out: function (event, ui) {
		},
		over: function(event, ui) {
		}
	});
	
	$scht.draggable({
		helper: 'clone',
		cursor:'move', 
		revert: 'invalid',
		opacity:0.35,
		revertDuration: 300,
		containment: null, 
		start: function(e,ui) {
			
		},
		end: function(e,ui) {
			
		}
	});
	
});